package cn.dansj.service.Impl;

import cn.dansj.entity.InterfaceHistory;
import cn.dansj.repository.InterfaceHistoryRepository;
import cn.dansj.service.InterfaceHistoryService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class InterfaceHistoryServiceImpl implements InterfaceHistoryService {
    private final InterfaceHistoryRepository interfaceHistoryRepository;

    public InterfaceHistoryServiceImpl(InterfaceHistoryRepository interfaceHistoryRepository) {
        this.interfaceHistoryRepository = interfaceHistoryRepository;
    }

    @Override
    public void save(InterfaceHistory interfaceHistory) {
        interfaceHistoryRepository.save(interfaceHistory);
    }

    @Override
    public List<InterfaceHistory> getHistory(String interfaceSequence) {
        return interfaceHistoryRepository.getInterfaceHistoryByInterfaceSequenceOrderByCrtTimeDesc(interfaceSequence);
    }

    @Override
    public int countInterfaceHistoryByMd5(String md5) {
        return interfaceHistoryRepository.countInterfaceHistoryByMd5(md5);
    }
}
